<%@ page import="org.internna.iwebjtracker.spring.mvc.IssueController" %>
<%@ taglib prefix="iwebmvc" uri="http://tags.iwebmvc.com" %>
<%@ taglib prefix="iwebjtracker" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c-rt:set var="sessionUser" value="<%= org.internna.iwebmvc.security.UserManager.SESSION_USER %>" />
<c-rt:set var="issue" value="<%= IssueController.ISSUE %>" />
<c-rt:set var="issueVotes" value="<%= IssueController.ISSUE_VOTES %>" />
<c-rt:set var="issueWatchers" value="<%= IssueController.ISSUE_WATCHERS %>" />
<c-rt:set var="lastUpdate" value="<%= IssueController.ISSUE_LAST_UPDATE %>" />
<c-rt:set var="isAdministrator" value="<%= IssueController.ISSUE_ADMINISTRATOR %>" />
<c-rt:set var="issueClass" value="<%= org.internna.iwebjtracker.model.DefaultIssue.class %>" />
<c-rt:set var="canRequestAssignation" value="<%= IssueController.CAN_REQUEST_WORK_OWNERSHIP %>" />
<c-rt:set var="trackerUser" value="<%= org.internna.iwebjtracker.spring.mvc.IWebJTrackerModelDecoratorInterceptor.TRACKER_USER %>" />
<div dojoType="dijit.layout.BorderContainer" gutters="false">
    <div dojoType="dijit.layout.ContentPane" region="center">
        <iwebmvc:panel title="${requestScope[issue].alias}" width="99%;margin:0">
            <table style="text-align:left;width:95%">
                <tbody>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.type" /></td>
                        <td style="width:20px"><img src="<c:url value="/resource.iwebmvc?file=/images/common/${fn:toLowerCase(requestScope[issue].type)}_${sessionScope[sessionUser].theme}.gif" />" alt="" /></td>
                        <td style="padding-left:10px"><iwebmvc:message argMessage="Type.${requestScope[issue].type}" /></td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.severity" /></td>
                        <td style="width:20px"><img src="<c:url value="/resource.iwebmvc?file=/images/common/${fn:toLowerCase(requestScope[issue].severity)}_${sessionScope[sessionUser].theme}.gif" />" alt="" /></td>
                        <td style="padding-left:10px"><iwebmvc:message argMessage="Severity.${requestScope[issue].severity}" /></td>
                    </tr>
                    <tr>
                        <td id="${requestScope[issue].alias}Status" style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.status" /></td>
                        <td style="width:20px"><img id="${requestScope[issue].alias}StatusImage" src="<c:url value="/resource.iwebmvc?file=/images/common/${fn:toLowerCase(requestScope[issue].status)}_${sessionScope[sessionUser].theme}.gif" />" alt="" /></td>
                        <td id="${requestScope[issue].alias}StatusContainer" style="padding-left:10px"><iwebmvc:message argMessage="Status.${requestScope[issue].status}" /></td>
                    </tr>
                    <tr>
                        <td id="${requestScope[issue].alias}ResolutionStatus" style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.resolution" /></td>
                        <td style="width:20px"><img id="${requestScope[issue].alias}ResolutionStatusImage" src="<c:url value="/resource.iwebmvc?file=/images/common/${fn:toLowerCase(requestScope[issue].resolutionStatus)}_${sessionScope[sessionUser].theme}.gif" />" alt="" /></td>
                        <td style="padding-left:10px"><iwebmvc:message argMessage="ResolutionStatus.${requestScope[issue].resolutionStatus}" /></td>
                    </tr>
                </tbody>
            </table>
        </iwebmvc:panel>
        <div class="panelSeparator"></div>
        <iwebmvc:panel title="ui.issue.environment" width="99%;margin:0">
            <table style="text-align:left;width:95%">
                <tbody>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.component" /></td>
                    </tr>
                    <tr>
                        <td><div style="width:100%;overflow:hidden;height:17px;text-overflow:ellipsis;">${requestScope[issue].parentModule.displayable}</div></td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.affected" /></td>
                    </tr>
                    <tr>
                        <td>${requestScope[issue].affectedVersion}</td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.target" altText="Target version" /></td>
                    </tr>
                    <tr>
                        <td id="${requestScope[issue].alias}TargetDisplayContainer">${requestScope[issue].targetVersion}&nbsp;</td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.fix" /></td>
                    </tr>
                    <tr>
                        <td>${requestScope[issue].fixVersion}</td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.reporter" /></td>
                    </tr>
                    <tr>
                        <td>${requestScope[issue].creator.name}</td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.created" /></td>
                    </tr>
                    <tr>
                        <td>${requestScope[issue].creationDate}</td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.lastupdate" /></td>
                    </tr>
                    <tr>
                        <td>${requestScope[lastUpdate]}</td>
                    </tr>
                </tbody>
            </table>
        </iwebmvc:panel>
        <div class="panelSeparator"></div>
        <c:if test="${requestScope[issue].assignee != null}">
            <iwebmvc:panel id="${requestScope[issue].alias}CurrentAssign" title="ui.issue.assigned" width="99%;margin:0">
                <div class="overclear">
                    <div class="float_left"><img src="${requestScope[issue].assignee.gravatar}" alt="" /></div>
                    <div class="float_right" style="width:50%;">
                        <div style="width:100%;overflow:hidden;height:18px;text-align:center;font-weight:bold">${requestScope[issue].assignee.name}</div>
                        <div class="label" style="width:100%;height:18px;text-align:center"><c:if test="${requestScope[issue].assignee.location != null}">(${requestScope[issue].assignee.location.displayable})</c:if></div>
                        <div style="width:100%;text-align:center;padding-top:5px"><b>Rep: </b>${requestScope[issue].assignee.reputation}
                            <img src="<c:url value="/resource.iwebmvc?file=/images/reputation_${sessionScope[sessionUser].theme}.gif" />" alt="<iwebmvc:message argMessage="ui.issue.reputation" />" style="vertical-align:bottom" />
                        </div>
                    </div>
                </div>
            </iwebmvc:panel>
        </c:if>
        <c:if test="${requestScope[canRequestAssignation] || requestScope[isAdministrator]}">
            <iwebmvc:panel id="${requestScope[issue].alias}MyAssign" title="ui.issue.assigned" width="99%;margin:0;display:none;">
                <div class="overclear">
                    <div class="float_left"><img id="${requestScope[issue].alias}Gravatar" src="${requestScope[trackerUser].gravatar}" alt="" /></div>
                    <div class="float_right" style="width:50%;">
                        <div id="${requestScope[issue].alias}TrackerUserContainer" style="width:100%;overflow:hidden;height:18px;text-align:center;font-weight:bold">${requestScope[trackerUser].name}</div>
                        <div id="${requestScope[issue].alias}TrackerUserLocationContainer" class="label" style="width:100%;height:18px;text-align:center"><c:if test="${requestScope[trackerUser].location != null}">(${requestScope[trackerUser].location.displayable})</c:if></div>
                        <div style="width:100%;text-align:center;padding-top:5px"><b>Rep: </b><span id="${requestScope[issue].alias}TrackerUserRepContainer">${requestScope[trackerUser].reputation}</span>
                            <img src="<c:url value="/resource.iwebmvc?file=/images/reputation_${sessionScope[sessionUser].theme}.gif" />" alt="<iwebmvc:message argMessage="ui.issue.reputation" />" style="vertical-align:bottom" />
                        </div>
                    </div>
                </div>
            </iwebmvc:panel>
        </c:if>
        <div class="panelSeparator"></div>
        <iwebmvc:panel title="ui.issue.community" width="99%;margin:0">
            <table style="text-align:left;width:95%">
                <tbody>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.votes" /></td>
                        <td id="${requestScope[issue].alias}Votes">${requestScope[issueVotes]}</td>
                        <td><img src="<c:url value="/resource.iwebmvc?file=/images/common/vote_${sessionScope[sessionUser].theme}.gif" />" alt="" style="vertical-align:bottom" /></td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold"><iwebmvc:message argMessage="ui.issue.watchers" /></td>
                        <td id="${requestScope[issue].alias}Watchers">${requestScope[issueWatchers]}</td>
                        <td><img src="<c:url value="/resource.iwebmvc?file=/images/common/watcher_${sessionScope[sessionUser].theme}.gif" />" alt="" /></td>
                    </tr>
                </tbody>
            </table>
        </iwebmvc:panel>
    </div>
    <div dojoType="dijit.layout.ContentPane" region="bottom" style="height:15%;">
        <div style="display:table;height:100%;width:99%;">
            <div style="display:table-cell;vertical-align:bottom;height:100%;width:99%;">
                <div style="padding:5px;margin-top:10px;margin-right:2px;text-align:right;" class="border_${sessionScope[sessionUser].theme}">
                    <span style="font-weight:bold;margin-right:3px;color: #<c:if test='${sessionScope[sessionUser].theme == "soria"}'>336699</c:if><c:if test='${sessionScope[sessionUser].theme == "tundra"}'>606060</c:if><c:if test='${sessionScope[sessionUser].theme == "nihilo"}'>CC6600</c:if>">${requestScope[issue].alias}</span>
                    <a href="<c:url value="/rss/${requestScope[issue].alias}" />"><img style="vertical-align:middle;width:28px;height:28px" src="<c:url value="/resource.iwebmvc?file=/images/rss_" />${sessionScope[sessionUser].theme}.png" alt="RSS 2.0" /></a>
                    <a href="http://fusion.google.com/add?source=atgs&feedurl=${iwebmvc:getApplicationUrl(pageContext.request)}<c:url value="/rss/${requestScope[issue].alias}" />"><img style="vertical-align:middle" src="<c:url value="/resource.iwebmvc?file=/images/google_" />${sessionScope[sessionUser].theme}.png" alt="Google Reader" title="Google Reader" /></a>
                </div>
            </div>
        </div>
    </div>
</div>